package code.lucamarrocco.rest;

public class Plural {
	public static final String plural(String name) {
		
		// name that is already plural
		if(name.equalsIgnoreCase("people")) return name;
		if(name.endsWith("s")) return name;
		
		name = name.concat("s");
		
		// plural exception
		if (name.endsWith("ys")) name = name.replaceAll("ys$", "ies");
		if (name.equalsIgnoreCase("person")) name = "people";
		
		return name;
	}
}
